1. Field of the Invention
This invention relates generally to non-volatile memory, and more particularly to providing data integrity when using the CopyBack command in a non-volatile memory system.
2. Description of the Related Art
In general, non-volatile memory is memory that stores data when power is disconnected from the system. Phase-change memory (PCM) and flash memory are examples of non-volatile computer memory in use today. Non-volatile memory is a non-volatile computer memory that can be electrically erased and reprogrammed. Because non-volatile memory retains stored data even when power to the memory is turned off, non-volatile memory is widely used in battery-driven portable devices. For example, non-volatile memory often is utilized in digital audio players, digital cameras, mobile phones, and USB flash drives, which are used for general storage and transfer of data between computers.
Often, non-volatile memory devices, such as flash devices, are designed to utilize two different types of technology, NOR technology and NAND technology. NOR flash devices have long erase and write times, but have an input/output (I/O) interface that allows random access to any location in the memory. As a result, NOR flash devices typically are used for storing executable code, where the data that is stored is accessed in words or single instruction elements. Typically these accesses are to random locations because code execution often is non-sequential. This ability to fetch instructions from a flash device often is called “Execute in Place” (XIP).
NAND flash devices have faster erase/write times, higher density, and a lower cost per bit than NOR flash. However NAND flash devices have an I/O interface that allows only sequential access to data. As a result, NAND flash devices typically are used for storing data that is accessed in fixed sized pages. Typically these accesses are for a complete page of data. Although the read access time for a page is relatively slow for the first byte, the read access time for subsequent sequential bytes in the same page is extremely fast. Because of the inexpensive nature of the memory, NAND flash devices generally implement error correction code (ECC) functionality for data integrity.
Unlike many other storage devices, NAND flash devices cannot be overwritten. Instead, to update data in a particular storage location within flash memory, the location must first be erased, then the new data written in its place. Moreover, when erasing data in a flash device, an entire block must be erased instead of just the particular page or pages of the block that were updated. To facilitate this process, a typical flash controller will find a block of memory that has been previously erased and write the updated page to this new block at the same page offset. Then, the remaining pages of the old block are copied to the new block, as illustrated next in FIG. 1.
FIG. 1 is a diagram showing a prior art non-volatile memory system. In the example of FIG. 1, the non-volatile memory system is a flash system 100. The flash system 100 includes a flash device 102 having a plurality of blocks 104, with each block comprising a plurality of pages 106. The flash device 102 also includes a page buffer 108 for input/output (I/O) operations. Coupled to the flash device 102 is a flash controller 110, which is also coupled to a system data buffer 112.
To update the data in page 106a in block 104a, for example, the flash controller 110 locates a previously erased block, such as block 104b, in which to store the data from page 106a once updated. The data from page 106a is transferred to the page buffer 108. Then, the flash controller 110 reads the page 106a data from the page buffer 110 and writes the page 106a data to the system data buffer 112, where the data is updated. The flash controller 110 then reads the updated page 106a data from the system data buffer 112 and writes the updated page 106a data to the page buffer 108. The updated page 106a data then is written to the corresponding page 106a′ in new block 104b. 
Sometimes the page data is not read from page 106a because the host already has access to a page containing the updated information. In this case, the host sends a request for the updated page data to be written to memory, typically using a “WriteNewPage” command. In response, the flash controller 110 writes the updated page data to the page buffer 108. The updated page data then is written to the corresponding page 106a′ in new block 104b. 
Generally, while transferring the data to and from the flash controller, error correction code (ECC) logic is applied to the data to find and correct any correctable errors present in the data. After the updated data is stored in the new page 106a′ of the new block 104b, the remainder of the pages from block 104a are transferred to the new block 104b, as illustrated next with reference to FIG. 2.
FIG. 2 is a diagram showing the prior art flash system 100 after transferring the remaining data in block 104a to the new block 104b. As above, the flash system 100 includes the flash device 102 having a plurality of blocks 104, with each block comprising a plurality of pages 106. The flash device 102 also includes a page buffer 108 for I/O operations. Coupled to the flash device 102 is the flash controller 110, which is also coupled to the system data buffer 112.
As mention above, the data in the remainder of the pages 106b of the block 104a needs to be transferred to the new block 104b. To improve flash system performance, the flash device 102 typically includes CopyBack functionality for data movement. A CopyBack command requests the flash device 102 to move the data in a page 106 from one location to the page with the same offset in another location internally within the flash device 102, without requiring the data to pass through flash controller 110 or the system data buffer 112.
Thus, the flash controller 110 issues a CopyBack command to the flash device 102 indicating the old and new locations for a page. The flash device 102 responds by moving the data from the old page location to the new page location. In the example of FIG. 2, the flash controller 110 issues a CopyBack command for each of the remaining pages 106b of block 104a indicating the corresponding page offset in the new block 104b. The flash device 102 then transfers the data from each page 106b to the corresponding page 106b′ in the new block 104b. Thereafter, when time permits, the old block 104a can be erased. Unfortunately, the CopyBack command transfers the data without performing any ECC logic on the data.
The inexpensive nature of the NAND memory results in a chance for errors being introduced in the data when the data is written to or moved in flash memory. Moreover, as demand for greater functionality in devices has increased, so has demand for flash memory with greater storage capacity. To address such demands, multilevel-cell (MLC) flash memory has been developed. Single Level Cell (SLC) flash memory cells contain one bit of data in each memory cell. MLC memory cells contain two or more bits of data, thereby increasing the storage capacity of the device. Unfortunately, MLC flash memory is much less reliable than SLC flash memory.
Each time a page 106 of data is written to the flash device or moved from one location within the flash device 102 to another location within the flash device 102, there is a chance of a new error being introduced. Hence, the number of media defects accumulates as pages of data are moved from one block to another using the CopyBack data movement operation. As a result, if a page of data is moved enough times without being examined for errors, there is a substantial chance that what were once correctable errors become uncorrectable errors because of too many errors being introduced in the data.
In view of the foregoing, there is a need for systems and methods for providing data integrity when using the CopyBack command in a flash memory system. The systems and methods should reduce accumulated errors caused by CopyBack data transfer within the flash memory, yet still allow improved system performance through use of the CopyBack command.